package cn.com.suiyi.shixingshengxian.mine;

import android.content.Intent;
import android.view.View;
import android.widget.RelativeLayout;
import android.widget.TextView;

import butterknife.ButterKnife;
import butterknife.InjectView;
import butterknife.OnClick;
import cn.com.suiyi.shixingshengxian.R;
import cn.com.suiyi.shixingshengxian.base.MVPFragment;
import cn.com.suiyi.shixingshengxian.bean.MineMessage;
import cn.com.suiyi.shixingshengxian.mine.info.InfoActivity;
import cn.com.suiyi.shixingshengxian.mine.pay.PayActivity;

/**
 * Created by Administrator on 2016/7/18.
 */
public class MineFragment extends MVPFragment<MineContract.MineView, MinePresenter> implements MineContract.MineView {
    @InjectView(R.id.layout_indent_mine)
    RelativeLayout layoutIndentMine;
    @InjectView(R.id.layout_delivery_mine)
    RelativeLayout layoutDeliveryMine;
    @InjectView(R.id.layout_pickup_mine)
    RelativeLayout layoutPointsMine;
    @InjectView(R.id.layout_receive_mine)
    RelativeLayout layoutReceiveMine;
    @InjectView(R.id.layout_sales_return_mine)
    RelativeLayout layoutSalesReturnMine;
    @InjectView(R.id.layout_account_mine)
    RelativeLayout layoutAccountMine;
    @InjectView(R.id.layout_coupon_mine)
    RelativeLayout layoutCouponMine;
    @InjectView(R.id.layout_pickup_mine)
    RelativeLayout layoutPickupMine;
    @InjectView(R.id.layout_balance_mine)
    RelativeLayout layoutBalanceMine;
    @InjectView(R.id.layout_recharge_mine)
    RelativeLayout layoutRechargeMine;
    @InjectView(R.id.layout_shop_mine)
    RelativeLayout layoutShopMine;
    @InjectView(R.id.layout_set_mine)
    RelativeLayout layoutSetMine;
    @InjectView(R.id.layout_adress_mine)
    RelativeLayout layoutAdressMine;
    @InjectView(R.id.layout_receipt_mine)
    RelativeLayout layoutReceiptMine;
    @InjectView(R.id.layout_card_mine)
    RelativeLayout layoutCardMine;
    @InjectView(R.id.layout_info_mine)
    RelativeLayout layoutInfoMine;
    @InjectView(R.id.textview_user_mine)
    TextView textviewUserMine;
    @InjectView(R.id.textview_vip_mine)
    TextView textviewVipMine;
    @InjectView(R.id.textview_gradevip_mine)
    TextView textviewGradevipMine;
    TextView graderatio;
    @InjectView(R.id.textview_collext_count_mine)
    TextView textviewCollectCountMine;
    @InjectView(R.id.textview_browse_count_mine)
    TextView textviewBrowseCountMine;
    @InjectView(R.id.textview_integral_count_mine)
    TextView textviewCreditCountMine;

    @Override
    public int getLayout() {
        return R.layout.fragment_mine;
    }


    @Override
    protected void initData() {

    }

    @Override
    public void initView() {

    }


    @Override
    public MinePresenter getPresenter() {
        return new MinePresenter();
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        ButterKnife.reset(this);
    }

    @OnClick({R.id.layout_indent_mine, R.id.layout_delivery_mine,
            R.id.layout_pickup_mine, R.id.layout_receive_mine,
            R.id.layout_sales_return_mine, R.id.layout_account_mine,
            R.id.layout_coupon_mine, R.id.layout_points_mine,
            R.id.layout_balance_mine, R.id.layout_recharge_mine,
            R.id.layout_shop_mine, R.id.layout_set_mine, R.id.layout_adress_mine,
            R.id.layout_receipt_mine, R.id.layout_card_mine, R.id.layout_info_mine})
    public void onClick(View view) {
        Intent intent;
        switch (view.getId()) {
            case R.id.layout_indent_mine:
                break;
            case R.id.layout_delivery_mine:
                break;
            case R.id.layout_pickup_mine:
                break;
            case R.id.layout_receive_mine:
                break;
            case R.id.layout_sales_return_mine:
                break;
            case R.id.layout_account_mine:
                break;
            case R.id.layout_coupon_mine:
                break;
            case R.id.layout_points_mine:
                break;
            case R.id.layout_balance_mine:
                break;
            case R.id.layout_recharge_mine:
                break;
            case R.id.layout_shop_mine:
                intent = new Intent(getActivity(), PayActivity.class);
                startActivity(intent);
                break;
            case R.id.layout_set_mine:
                break;
            case R.id.layout_adress_mine:
                break;
            case R.id.layout_receipt_mine:
                break;
            case R.id.layout_card_mine:
                break;
            case R.id.layout_info_mine:
                intent = new Intent();
                intent.setClass(getActivity(), InfoActivity.class);
                startActivity(intent);
                break;
        }
    }

    @Override
    public void onSuccess(MineMessage mineMessage) {
        textviewUserMine.setText(mineMessage.getData().getNickname());
        textviewVipMine.setText(mineMessage.getData().getGradename());
        textviewCollectCountMine.setText(mineMessage.getData().getCollect());
        textviewGradevipMine.setText(mineMessage.getData().getGradevip());
        graderatio.setText(mineMessage.getData().getGraderatio());
        textviewBrowseCountMine.setText(mineMessage.getData().getMessage());
        textviewCreditCountMine.setText(mineMessage.getData().getIntegration());

    }

    @Override
    public void onFail(String 失败) {

    }

}
